﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Project.MVC.PhanQuyen.Model;

namespace Project.MVC.PhanQuyen.MsSQLDAL
{
    static class General
    {
        #region Nhóm công việc
        internal static PQNhomCongViecInfo GetInfo(PQ_NhomCongViec value)
        {
            if (value == null)
                return null;
            else
                return new PQNhomCongViecInfo
                {
                    Id = value.id,
                    TenNhom = value.tenNhom,
                    GhiChu = value.ghiChu,
                    UserName = value.userName,
                    UserFullName = value.userFullName,
                    TimeInput = value.timeInput,
                    RowVersion = value.rowVersion.ToArray(),
                };
        }
        internal static PQ_NhomCongViec GetInfo(PQNhomCongViecInfo value)
        {
            if (value == null)
                return null;
            else
                return new PQ_NhomCongViec
                {
                    id = value.Id,
                    tenNhom = value.TenNhom,
                    ghiChu = value.GhiChu,
                    userName = value.UserName,
                    userFullName = value.UserFullName,
                    timeInput = value.TimeInput,
                    //rowVersion = value.RowVersion,
                };
        }
        #endregion

        #region Công việc
        internal static PQCongViecInfo GetInfo(PQ_CongViec value)
        {
            if (value == null)
                return null;
            else
                return new PQCongViecInfo
                {
                    Id = value.id,
                    NhomCongViecInfo = GetInfo(value.PQ_NhomCongViec),
                    IdNhomCongViec = value.idNhomCongViec,
                    MaCongViec = value.maCongViec,
                    TenCongViec = value.tenCongViec,
                    TenController = value.tenController,
                    TenAction = value.tenAction,
                    OnMenu = value.onMenu,
                    DoUuTien = value.doUuTien,
                    VuViec = value.vuViec,
                    GhiChu = value.ghiChu,
                    UserName = value.userName,
                    UserFullName = value.userFullName,
                    TimeInput = value.timeInput,
                    RowVersion = value.rowVersion.ToArray(),
                };
        }
        internal static PQ_CongViec GetInfo(PQCongViecInfo value)
        {
            if (value == null)
                return null;
            else
                return new PQ_CongViec
                {
                    id = value.Id,
                    idNhomCongViec =(int) value.IdNhomCongViec,
                    maCongViec = value.MaCongViec,
                    tenCongViec = value.TenCongViec,
                    tenController = value.TenController,
                    tenAction = value.TenAction,
                    onMenu = value.OnMenu,
                    doUuTien = value.DoUuTien,
                    vuViec = value.VuViec,
                    ghiChu = value.GhiChu,
                    userName = value.UserName,
                    userFullName = value.UserFullName,
                    timeInput = value.TimeInput,
                    //rowVersion = value.RowVersion,
                };
        }
        #endregion

        #region Nhóm sử dụng
        internal static PQNhomSuDungInfo GetInfo(PQ_NhomSuDung value)
        {
            if (value == null)
                return null;
            else
                return new PQNhomSuDungInfo
                {
                    Id = value.id,
                    maNhom = value.maNhom,
                    TenNhom = value.tenNhom,
                    GhiChu = value.ghiChu,
                    UserName = value.userName,
                    UserFullName = value.userFullName,
                    TimeInput = value.timeInput,
                    RowVersion = value.rowVersion.ToArray(),
                };
        }
        internal static PQ_NhomSuDung GetInfo(PQNhomSuDungInfo value)
        {
            if (value == null)
                return null;
            else
                return new PQ_NhomSuDung
                {
                    id = value.Id,
                    tenNhom = value.TenNhom,
                    maNhom = value.maNhom,
                    ghiChu = value.GhiChu,
                    userName = value.UserName,
                    userFullName = value.UserFullName,
                    timeInput = value.TimeInput,
                    //rowVersion = value.RowVersion,
                };
        }
        #endregion

        #region Nhóm sử dụng - Công việc
        internal static PQNhomSuDungCongViecInfo GetInfo(PQ_NhomSuDung_CongViec value)
        {
            if (value == null)
                return null;
            else
                return new PQNhomSuDungCongViecInfo
                {
                    IdNhomSuDung = value.idNhomSuDung,
                    IdCongViec = value.idCongViec,
                    VuViec = value.vuViec,
                    CongViecInfo = GetInfo(value.PQ_CongViec),
                    UserName = value.userName,
                    UserFullName = value.userFullName,
                    TimeInput = value.timeInput,
                    RowVersion = value.rowVersion.ToArray(),
                };
        }
        internal static PQ_NhomSuDung_CongViec GetInfo(PQNhomSuDungCongViecInfo value)
        {
            if (value == null)
                return null;
            else
                return new PQ_NhomSuDung_CongViec
                {
                    idNhomSuDung = value.IdNhomSuDung,
                    idCongViec = value.IdCongViec,
                    vuViec = value.VuViec,
                    userName = value.UserName,
                    userFullName = value.UserFullName,
                    timeInput = value.TimeInput,
                    //rowVersion = value.RowVersion,
                };
        }
        #endregion

        #region Người sử dụng
        internal static PQNguoiDungInfo GetInfo(PQ_NguoiDung value)
        {
            if (value == null)
                return null;
            else
                return new PQNguoiDungInfo
                {
                    Id = value.id,
                    TenNguoiDung = value.tenNguoiDung,
                    HoTenNguoiDung = value.hoTenNguoiDung,
                    MatKhau = value.matKhau,
                    Email = value.email,
                    DienThoai = value.dienThoai,
                    TrangThai = value.trangThai,
                    GhiChu = value.ghiChu,
                    MaNhanVien = value.maNhanVien,
                    UserName = value.userName,
                    UserFullName = value.userFullName,
                    TimeInput = value.timeInput,
                    RowVersion = value.rowVersion.ToArray(),
                };
        }
        internal static PQ_NguoiDung GetInfo(PQNguoiDungInfo value)
        {
            if (value == null)
                return null;
            else
                return new PQ_NguoiDung
                {
                    id = value.Id,
                    tenNguoiDung = value.TenNguoiDung,
                    hoTenNguoiDung = value.HoTenNguoiDung,
                    matKhau = value.MatKhau,
                    email = value.Email,
                    dienThoai = value.DienThoai,
                    trangThai = value.TrangThai,
                    ghiChu = value.GhiChu,
                    maNhanVien = value.MaNhanVien,
                    userName = value.UserName,
                    userFullName = value.UserFullName,
                    timeInput = value.TimeInput,
                    //rowVersion = value.RowVersion,
                };
        }
        #endregion
    }
}
